// 节流
export function throttling(fn:() => void){
    var timer:any = null
    return function(){
        if(!timer){
            timer = setTimeout(()=>{
                fn()
                timer = null
            },300)
        }
    }
}
// 防抖
export function antShaking(fn:()=>void){
    var timer: string | number | NodeJS.Timeout | null | undefined = null
    return function(){
        if(timer){
            clearTimeout(timer)
        }
        timer = setTimeout(()=>{
           fn()
        },500)
    }
}